import webbrowser as web_go
import baisou
import os
sou_name = input('请输入搜索内容：')
sou = baisou.sou(sou_name)
urls = [item['url'] for item in sou if 'url' in item]
for url in urls:
    print(url)

end = len(urls)
print(f'共搜索到{end}个结果')
print('请问您想访问哪个呢?')
xuan_str = input(':')
xuan = int(xuan_str)
url_xuan = urls[xuan]
web_go.open(url_xuan)
print('请问您需要再次使用吗？ (1,是的   2,不用了)')
jue_xuan = input(':')
jue = int(jue_xuan)
if jue == 1 :
    os.system('python sou.py')
else:
    print('Ok!')
